#pragma once
#include <stdint.h>
#ifndef __cplusplus
typedef char    bool;
#define true    1
#define false   0
#endif

/**
 * @ingroup module_MacroDefinition
 * @~chinese
 * @brief 设备离线事件通知
 * @~english
 * @brief Device offline event notification
 */
#define SCI_CAM_EVENT_OFFLINE 1001

 /**
  * @ingroup module_MacroDefinition
  * @~chinese
  * @brief 跳帧事件通知
  * @~english
  * @brief Frame skipping event notification
  */
#define SCI_CAM_EVENT_FRAME_SKIP 5001

  /**
   * @ingroup module_TypeDefinition
   * @~chinese
   * @brief 设备传输类型
   * @~english
   * @brief Device transport type
   */
enum SciCamTLType
{
	SciCam_TLType_Unknown = 0,				///< \~chinese 未知类型									\~english Unkown type
	SciCam_TLType_Gige = 1,					///< \~chinese 千兆以太网								\~english Gigabit ethernet
	SciCam_TLType_Usb3 = 2,					///< \~chinese USB 3.0									\~english USB 3.0
	SciCam_TLType_CL = 4,					///< \~chinese CameraLink								\~english CameraLink
	SciCam_TLType_CXP = 8,					///< \~chinese CoaXPress								\~english CoaXPress
	SciCam_TLType_IIDC = 16,				///< \~chinese 1394-based Digital Camera Specification	\~english 1394-based Digital Camera Specification
	SciCam_TLType_UVC = 32,					///< \~chinese USB Video Class							\~english USB Video Class
	SciCam_TLType_CLHS = 64,				///< \~chinese Camera Link HS							\~english Camera Link HS
	SciCam_TLType_Ethernet = 128,			///< \~chinese Ethernet									\~english Ethernet
	SciCam_TLType_PCI = 256,				///< \~chinese Peripheral Component Interconnect		\~english Peripheral Component Interconnect
	SciCam_TLType_CL_CAM_ONLY = 32768,		///< \~chinese 仅支持CameraLink							\~english @brief Only supports CameraLink
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 设备类型
 * @~english
 * @brief Device type
 */
enum SciCamDeviceType
{
	SciCam_DeviceType_Unknown = 0,			///< \~chinese 未知类型			\~english unknown type
	SciCam_DeviceType_2D = 2,				///< \~chinese 2D设备			\~english 2D device
	SciCam_DeviceType_3DLP = 3,				///< \~chinese 3D线扫激光设备		\~english 3D LP device
	SciCam_DeviceType_3DSL = 4,				///< \~chinese 3D结构光设备		\~english 3D SL device
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 采集策略
 * @~english
 * @brief Grab strategy
 */
enum SciCamGrabStrategy
{
	SciCam_GrabStrategy_OneByOne = 0,		///< \~chinese 从旧到新一帧一帧的从输出缓存列表中获取图像，打开设备后默认为该策略			\~english Obtain image from output cache list frame by frame in order, this function is default strategy when device is on.
	SciCam_GrabStrategy_Latest = 1,			///< \~chinese 从输出缓存列表中获取最新的帧图像										\~english Retrieve the latest frame image from the output buffer list.
	SciCam_GrabStrategy_Upcoming = 2,		///< \~chinese 在调用取流接口时忽略输出缓存列表中所有图像，并等待设备即将生成的一帧图像	\~english Ignore all images in output cache list when calling image acuiqisiotn interface, wait the next upcoming image generated.
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 设备XML类型
 * @~english
 * @brief Device XML type
 */
enum SciCamDeviceXmlType
{
	SciCam_DeviceXml_Camera = 0,			///< \~chinese 相机		\~english Camera
	SciCam_DeviceXml_Card = 1,				///< \~chinese 采集卡	\~english Capture card
	SciCam_DeviceXml_TL = 2,				///< \~chinese 传输层	\~english Transport layer
	SciCam_DeviceXml_IF = 3,				///< \~chinese 接口层	\~english Interface layer
	SciCam_DeviceXml_DS = 4,				///< \~chinese 数据流	\~english Data stream
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 节点类型
 * @~english
 * @brief Node type
 */
enum SciCamNodeType
{
	SciCam_NodeType_Unknown = 0,			///< \~chinese 未知类型		\~english Unknown type
	SciCam_NodeType_Bool,					///< \~chinese bool类型		\~english bool type
	SciCam_NodeType_Int,					///< \~chinese int类型		\~english int type
	SciCam_NodeType_Float,					///< \~chinese float类型	\~english float type
	SciCam_NodeType_Enum,					///< \~chinese enum类型		\~english enum type
	SciCam_NodeType_Cmd,					///< \~chinese cmd类型		\~english cmd type
	SciCam_NodeType_String,					///< \~chinese string类型	\~english string type
	SciCam_NodeType_Category,				///< \~chinese category类型	\~english category type
	SciCam_NodeType_Register,				///< \~chinese register类型	\~english register type
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 设备节点命名空间
 * @~english
 * @brief Device node namespace
 */
enum SciCamNodeNameSpace
{
	SciCam_NodeNameSpace_Custom = 0,		///< \~chinese 自定义命名空间		\~english Custom namespace
	SciCam_NodeNameSpace_Standard,			///< \~chinese 标准命名空间			\~english Standard namespace
	SciCam_NodeNameSpace_Unknown,			///< \~chinese 未知命名空间			\~english Unknown namespace
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 节点分组可见性类型
 * @~english
 * @brief Device node visibility
 */
enum SciCamNodeVisibility
{
	SciCam_NodeVisibility_Beginner = 0,		///< \~chinese 初学者可见				\~english Visibility for beginners user
	SciCam_NodeVisibility_Expert = 1,		///< \~chinese 专家可见					\~english Visibility for expert user
	SciCam_NodeVisibility_Guru = 2,			///< \~chinese 高级用户（骨灰级）可见	\~english Visibility for guru user
	SciCam_NodeVisibility_Invisible = 3,	///< \~chinese 不可见性					\~english Invisible visibility
	SciCam_NodeVisibility_Unknown = 99,		///< \~chinese 未知可见性				\~english Unknown visibility
};

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 设备节点访问模式
 * @~english
 * @brief Device node access mode
 */
enum SciCamNodeAccessMode
{
	SciCam_NodeAccessMode_NI = 0,			///< \~chinese 不可用				\~english Not implemented
	SciCam_NodeAccessMode_NA,				///< \~chinese 不可访问				\~english Not accessible
	SciCam_NodeAccessMode_WO,				///< \~chinese 只写					\~english Write only
	SciCam_NodeAccessMode_RO,				///< \~chinese 只读					\~english Read only
	SciCam_NodeAccessMode_RW,				///< \~chinese 读写					\~english Read/Write
	SciCam_NodeAccessMode_Unknown,			///< \~chinese 未知模式				\~english Unknown mode
	SciCam_NodeAccessMode_CycleDetect,		///< \~chinese 循环检测				\~english Cycle detect
};

/**
 * @~chinese
 * @brief GigE设备信息
 * @~english
 * @brief GigE device info
 */
typedef struct _SCI_DEVICE_GIGE_INFO_
{
	unsigned char		status;						///< \~chinese 设备状态		\~english Device status
	unsigned char       name[64];					///< \~chinese 设备名称		\~english Device name
	unsigned char       manufactureName[32];		///< \~chinese 制造商名称		\~english Manufacture name
	unsigned char       modelName[32];				///< \~chinese 型号名称		\~english Model name
	unsigned char       version[32];				///< \~chinese 版本号		\~english Version
	unsigned char       userDefineName[16];			///< \~chinese 用户自定义名称	\~english User define name
	unsigned char       serialNumber[16];			///< \~chinese 序列号		\~english Serial number
	unsigned char		mac[6];						///< \~chinese 设备MAC地址	\~english Device mac
	unsigned int        ip;							///< \~chinese 设备IP地址		\~english Device ip
	unsigned int        mask;						///< \~chinese 设备子网掩码	\~english Device mask
	unsigned int        gateway;					///< \~chinese 设备网关		\~english Device gateway
	unsigned int        adapterIp;					///< \~chinese 主机IP地址		\~english Adapter ip
	unsigned int		adapterMask;				///< \~chinese 主机子网掩码	\~english Adapter mask
	unsigned char       adapterName[260];			///< \~chinese 主机网卡名		\~english Adapter name

}SCI_DEVICE_GIGE_INFO, * PSCI_DEVICE_GIGE_INFO;

/**
 * @~chinese
 * @brief USB3.0 设备信息
 * @~english
 * @brief USB3.0 device info
 */
typedef struct _SCI_DEVICE_USB3_INFO_
{
	unsigned char		status;						///< \~chinese 设备状态		\~english Device status
	unsigned char       name[64];					///< \~chinese 设备名称		\~english Device name
	unsigned char       manufactureName[64];		///< \~chinese 制造商名称		\~english Manufacture name
	unsigned char       modelName[64];				///< \~chinese 型号名称		\~english Model name
	unsigned char       version[64];				///< \~chinese 版本号		\~english Version
	unsigned char       userDefineName[64];			///< \~chinese 用户自定义名称	\~english User define name
	unsigned char       serialNumber[64];			///< \~chinese 序列号		\~english Serial number
	unsigned char       guid[64];					///< \~chinese GUID			\~english GUID
	unsigned char       U3VVersion[64];				///< \~chinese U3V版本号		\~english U3V version
	unsigned char       GenCPVersion[64];			///< \~chinese GenCP版本号	\~english GenCP version
}SCI_DEVICE_USB3_INFO, * PSCI_DEVICE_USB3_INFO;

/**
 * @~chinese
 * @brief CameraLink 设备信息
 * @~english
 * @brief CameraLink device info
 */
typedef struct _SCI_DEVICE_CL_INFO_
{
	unsigned char       cardStatus;					///< \~chinese 采集卡状态				\~english Card status
	unsigned char		cardName[64];				///< \~chinese 采集卡名称				\~english Card name
	unsigned char       cardManufacture[64];		///< \~chinese 采集卡制造商名称		\~english Card manufacture name
	unsigned char       cardModel[64];				///< \~chinese 采集卡型号				\~english Card model
	unsigned char       cardVersion[64];			///< \~chinese 采集卡版本号			\~english Card version
	unsigned char       cardUserDefineName[64];		///< \~chinese 采集卡用户自定义名称	\~english Card user define name
	unsigned char       cardSerialNumber[64];		///< \~chinese 采集卡序列号			\~english Card serial number

	unsigned char       cameraStatus;				///< \~chinese 相机状态				\~english Camera status; 0: Unkown, 1: Ok, 2: Busy, 3: Overtime;
	unsigned char       cameraType;					///< \~chinese 相机类型				\~english Camera type; 0: Unkown, 1: GenCP, 2: Aike
	unsigned int		cameraBaud;					///< \~chinese 相机波特率				\~english Camera baud
	unsigned char		cameraManufacture[64];		///< \~chinese 相机制造商名称			\~english Camera manufacture name
	unsigned char		cameraFamily[64];			///< \~chinese 相机家族				\~english Camera family
	unsigned char		cameraModel[64];			///< \~chinese 相机型号				\~english Camera model
	unsigned char		cameraVersion[64];			///< \~chinese 相机版本号				\~english Camera version
	unsigned char		cameraSerialNumber[64];		///< \~chinese 相机序列号				\~english Camera serial number
	unsigned char		cameraSerialPort[64];		///< \~chinese 相机串口号				\~english Camera serial port
	unsigned char		cameraProtocol[256];		///< \~chinese 相机协议				\~english Camera protocol

}SCI_DEVICE_CL_INFO, * PSCI_DEVICE_CL_INFO;

/**
 * @~chinese
 * @brief CXP 设备信息
 * @~english
 * @brief CXP device info
 */
typedef struct _SCI_DEVICE_CXP_INFO_
{
	unsigned char       extend[2048];				///< \~chinese 预留扩展				\~english extend
}SCI_DEVICE_CXP_INFO, * PSCI_DEVICE_CXP_INFO;

/**
 * @~chinese
 * @brief 设备信息结构体
 * @~english
 * @brief Device info struct
 */
typedef struct _SCI_DEVICE_INFO_
{
	enum SciCamTLType tlType;			///< \~chinese 设备传输类型				\~english Device TL type
	enum SciCamDeviceType devType;		///< \~chinese 设备类型					\~english Device type
	unsigned char reserve[256];			///< \~chinese 预留扩展					\~english extend

	union
	{
		SCI_DEVICE_GIGE_INFO gigeInfo;	///< \~chinese GigE设备信息				\~english GigE device info
		SCI_DEVICE_USB3_INFO usb3Info;	///< \~chinese U3V设备信息				\~english U3V device info
		SCI_DEVICE_CL_INFO clInfo;		///< \~chinese CameraLink设备信息			\~english CameraLink device info
		SCI_DEVICE_CXP_INFO cxpInfo;	///< \~chinese CXP设备信息				\~english CXP device info
	}info;

}SCI_DEVICE_INFO, * PSCI_DEVICE_INFO;

/**
 * @~chinese
 * @brief 设备信息列表
 * @~english
 * @brief Device info list
 */
typedef struct _SCI_DEVICE_INFO_LIST_
{
	unsigned int count;					///< \~chinese 在线设备数量					\~english Number of Online Devices
	SCI_DEVICE_INFO pDevInfo[256];		///< \~chinese 设备信息数组（最多支持256个设备）	\~english Device Information Array (Supports up to 256 devices)
}SCI_DEVICE_INFO_LIST, * PSCI_DEVICE_INFO_LIST;

/**
 * @~chinese
 * @brief Int类型值
 * @~english
 * @brief Int Value
 */
typedef struct _SCI_NODE_VAL_INT_
{
	int64_t nVal;			///< \~chinese 当前值	\~english Current Value
	int64_t nMax;			///< \~chinese 最大值	\~english Max value
	int64_t nMin;			///< \~chinese 最小值	\~english Min value
	int64_t nInc;			///< \~chinese 步长		\~english Step
}SCI_NODE_VAL_INT, * PSCI_NODE_VAL_INT;

/**
 * @~chinese
 * @brief Float类型值
 * @~english
 * @brief Float Value
 */
typedef struct _SCI_NODE_VAL_FLOAT_
{
	double dVal;			///< \~chinese 当前值	\~english Current Value	
	double dMax;			///< \~chinese 最大值	\~english Max value
	double dMin;			///< \~chinese 最小值	\~english Min value
	double dInc;			///< \~chinese 步长		\~english Step

}SCI_NODE_VAL_FLOAT, * PSCI_NODE_VAL_FLOAT;

/**
 * @~chinese
 * @brief String类型值
 * @~english
 * @brief String Value
 */
typedef struct _SCI_NODE_VAL_STRING_
{
	char val[1024];			///< \~chinese 当前值	\~english Current Value	
}SCI_NODE_VAL_STRING, * PSCI_NODE_VAL_STRING;

/**
 * @~chinese
 * @brief Enum item值
 * @~english
 * @brief Enum item Value
 */
typedef struct _SCI_NODE_VAL_ENUM_ITEM_
{
	int64_t val;			///< \~chinese 枚举值	\~english Enumerated Value
	char desc[256];			///< \~chinese 枚举描述	\~english Enumeration Description
}SCI_NODE_VAL_ENUM_ITEM, * PSCI_NODE_VAL_ENUM_ITEM;

/**
 * @~chinese
 * @brief Enum类型值
 * @~english
 * @brief Enum Value
 */
typedef struct _SCI_NODE_VAL_ENUM_
{
	int64_t nVal;						///< \~chinese 当前值		\~english Current Value	
	unsigned int itemCount;				///< \~chinese 有效数据个数	\~english Number of Valid Data
	SCI_NODE_VAL_ENUM_ITEM items[64];	///< \~chinese 支持的枚举值	\~english Supported Enumerated Values
}SCI_NODE_VAL_ENUM, * PSCI_NODE_VAL_ENUM;

/**
 * @~chinese
 * @brief 设备节点
 * @~english
 * @brief Device node
 */
typedef struct _SCI_CAM_NODE_
{
	SciCamNodeType type;				///< \~chinese 节点类型		\~english Node type
	SciCamNodeNameSpace nameSpace;		///< \~chinese 名字空间		\~english Namespace
	SciCamNodeVisibility visibility;	///< \~chinese 可见性		\~english Visibility
	SciCamNodeAccessMode accessMode;	///< \~chinese 访问权限		\~english AccessMode
	int level;							///< \~chinese 节点层级		\~english Node level
	char name[256];						///< \~chinese 节点名称		\~english Node name
	char desc[256];						///< \~chinese 描述			\~english Describe
}SCI_CAM_NODE, * PSCI_CAM_NODE;

/**
 * @~chinese
 * @brief 设备事件
 * @~english
 * @brief Device event
 */
typedef struct _SCI_CAM_EVENT_
{
	uint64_t id;			///< \~chinese 事件ID									\~english Event ID
	uint64_t tick;			///< \~chinese 事件时间戳（单位：us）					\~english Event timestamp(unit: us)
	void* data;				///< \~chinese 数据（依事件ID值分类）					\~english Data(Classified by event ID value)
	uint64_t len;			///< \~chinese 数据长度（或者整形参数，依事件ID值分类）		\~english Data length(or integer parameter, classified by event ID value)
}SCI_CAM_EVENT, * PSCI_CAM_EVENT;

/**
 * @ingroup module_TypeDefinition
 * @~chinese
 * @brief 3D线扫激光轮廓设备采集模式
 * @~english
 * @brief 3D LP Camera grab mode
 */
enum SciCamLp3dGrabMode
{
	SciCam_GrabMode_LP3D_None = 0,			///< \~chinese 无		\~english None
	SciCam_GrabMode_LP3D_Image = 1,			///< \~chinese 2D图像	\~english Image mode
	SciCam_GrabMode_LP3D_Contour = 2,		///< \~chinese 轮廓		\~english Contour mode
	SciCam_GrabMode_LP3D_BatchContour = 3,	///< \~chinese 3D深度图	\~english Batch Contour mode
};